package com.column;

import java.io.File;

public class Main42 {
    public static void main(String[] argv)throws Exception{
        deleteDir(new File("./test"));
    }
    public static boolean deleteDir(File dir){
        if(dir.isDirectory()){
            String[] children=dir.list();
            for(int i=0;i<children.length;i++){
                boolean success=deleteDir(new File(dir,children[i]));
                if(!success){
                    return false;
                }
            }
        }
        if(dir.delete()){
            System.out.println("删除成功");
            return true;
        }else{
            System.out.println("删除失败");
            return false;
        }
    }
}
